<?php

namespace App\Sidong\Controllers;

use App\Http\Controllers\Controller;
use Encore\Admin\Widgets\Box;
use Encore\Admin\Widgets\InfoBox;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        $content->title('控制台');
        $content->row(function(Row $row) {
            $row->column(2, function (Column $column) {
                $column->append(Dashboard::userInfoBox()); // 用户总数
            });
            $row->column(2, function (Column $column) {
                $column->append(Dashboard::memberInfoBox());// 会员总数
            });
            $row->column(2, function (Column $column) {
                $column->append(Dashboard::coachInfoBox());// 私教总数
            });
            $row->column(2, function (Column $column) {
                $column->append(Dashboard::cardInfoBox());// 已上架会员卡
            });
            $row->column(2, function (Column $column) {
                $column->append(Dashboard::cardOrderInfoBox());// 会员卡订单收入
            });
            $row->column(2, function (Column $column) {
                $column->append(Dashboard::coachOrderInfoBox());// 私教订单收入
            });
        });
        $content->row(function(Row $row) {
            $row->column(8, function (Column $column) {
                $column->append(Dashboard::orderLineChart()); // 年度订单销售趋势
            });
            $row->column(4, function (Column $column) {
                $column->append(Dashboard::coachTopTable()); // 本月教练销售排名
            });
        });
        $content->row(function(Row $row) {
            $row->column(12, function (Column $column) {
                $column->append(Dashboard::newMemberLineChart()); // 新会员入驻趋势
            });
        });
        return $content;
    }
}
